package jwdt.web.action;

import jwdt.xadmin.info.bean.TType;

import com.ezerg.db.Jdb;
import com.ezerg.web.Form;
import com.ezerg.web.Module;
import com.ezerg.web.Page;

public class IndexAction extends BaseAction {
	
	public Page execute(Form f, Module m) throws Exception{
		//固顶
		f.add("tops", Jdb.get().query(super.select_news+" where istop=1 and checked=1 "+super.order_news+" limit 2"));
		//精华
		f.add("daodus", Jdb.get().query(super.select_news+" where daodu=1 and checked=1 "+super.order_news+" limit 8"));
		//最新
		f.add("news", Jdb.get().query(super.select_news+" where checked=1 "+super.order_news+" limit 9"));
		//
		int rows = 8;
		for(int i=10; i<=14; i++) {
			f.add("type"+i, Jdb.get().get(TType.class, i));
			super.getListByTypeFid(i, "bz"+i, rows, f);//
			super.getListByTypeFid2(i, 0, "bz"+i+"0", rows, f);//
			super.getListByTypeFid2(i, 1, "bz"+i+"1", rows, f);//
			super.getListByTypeFid2(i, 2, "bz"+i+"2", rows, f);//
			super.getListByTypeFid2(i, 3, "bz"+i+"3", rows, f);//
			super.getListByTypeFid2(i, 4, "bz"+i+"4", rows, f);//
		}
		//友情链接
		f.add("links",Jdb.get().query("select * from t_link where pass=1", 6));//链接
		//广告图片
		f.add("advimg1", Jdb.get().queryDataMap("select id,title,path,url from t_images where position=0 and zt=1 limit 1"));
		f.add("advimg2", Jdb.get().queryDataMap("select id,title,path,url from t_images where position=1 and zt=1 limit 1"));
		//
		return m.findPage("/index");
	}
	
}
